package gmat.test

import gmat.impl.MatrixJC
import gmat.intr.Matrix

public class NewMatrixExamples{
	final static all = Matrix.all
	
	static void main(args){
		printM()
		compareM()
		compareS()
		extendM()
	}
	
	static void printM(){
		def a = MatrixJC.make([[1, 2, 3], [4, 5, 6]])
		println a
	}
	
	static void compareM(){
		def a = MatrixJC.make([[1, 2, 3], [4, 5, 6]])
		def b = MatrixJC.make([a[0, all].list().collect({4 - it}), a[1, all].list().collect({8 - it})])
		a.indices().each({ if (a[it] == b[it]) println b[it].val() })
	}
	
	static void compareS(){
		def a = MatrixJC.make([[1, 2, 3], [4, 5, 6]])
		def b = MatrixJC.make([a[0, all].subFrom(4).list(), a[1, all].subFrom(8).list()])
		a.indices().each({ if (a[it] == b[it]) println b[it].val() })
	}
	
	static void extendM(){
		def a = MatrixJC.make([[1, 2, 3], [4, 5, 6]])
		a[2, 3] = 7
		println a
	}
}
